package com.game.centerserver.infrastructure.service.impl;

import com.game.centerserver.infrastructure.entity.FirewallPortRange;
import com.game.centerserver.infrastructure.dao.FirewallPortRangeDao;
import com.game.centerserver.infrastructure.service.FirewallPortRangeService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * (FirewallPortRange)表服务实现类
 *
 * @author makejava
 * @since 2024-12-16 22:01:13
 */
@Service("firewallPortRangeService")
public class FirewallPortRangeServiceImpl implements FirewallPortRangeService {
    @Resource
    private FirewallPortRangeDao firewallPortRangeDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public FirewallPortRange queryById(Integer id) {
        return this.firewallPortRangeDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param firewallPortRange 实例对象
     * @return 实例对象
     */
    @Override
    public FirewallPortRange insert(FirewallPortRange firewallPortRange) {
        this.firewallPortRangeDao.insert(firewallPortRange);
        return firewallPortRange;
    }

    /**
     * 修改数据
     *
     * @param firewallPortRange 实例对象
     * @return 实例对象
     */
    @Override
    public FirewallPortRange update(FirewallPortRange firewallPortRange) {
        this.firewallPortRangeDao.update(firewallPortRange);
        return this.queryById(firewallPortRange.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.firewallPortRangeDao.deleteById(id) > 0;
    }
}
